package com.jsoup.service.impl;

import com.jsoup.bean.Stayword;
import com.jsoup.mapper.StaywordMapper;
import com.jsoup.service.StaywordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class StaywordServiceImpl implements StaywordService {

    @Resource
    private StaywordMapper staywordMapper;

    @Override
    public int deleteByPrimaryKey(Integer staywordId) {
        return staywordMapper.deleteByPrimaryKey(staywordId);
    }

    @Override
    public int insert(Stayword record) {
        return staywordMapper.insert(record);
    }

    @Override
    public int insertSelective(Stayword record) {
        return staywordMapper.insertSelective(record);
    }

    @Override
    public Stayword selectByPrimaryKey(Integer staywordId) {
        return staywordMapper.selectByPrimaryKey(staywordId);
    }

    @Override
    public int updateByPrimaryKeySelective(Stayword record) {
        return staywordMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKeyWithBLOBs(Stayword record) {
        return staywordMapper.updateByPrimaryKeyWithBLOBs(record);
    }

    @Override
    public int updateByPrimaryKey(Stayword record) {
        return staywordMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<Stayword> selectStayword(Stayword stayword) {
        return staywordMapper.selectStayword(stayword);
    }

    @Override
    public Stayword getStayword(Stayword stayword) {
        List<Stayword> list = this.selectStayword(stayword);
        if (list == null || list.isEmpty()) {
            return null;
        }
        return list.get(0);
    }

    @Override
    public List<Stayword> searchStayword(Stayword stayword) {
        return staywordMapper.searchStayword(stayword);
    }
}
